\magnification=\magstep1
\input nice
%%\input amiga	% amiga.tex is in the formatfile
\hsize = 5 in
\vsize = 7.7 in
\voffset = 0.4in

\def\mynum#1{\ifnum #1<10 0\the#1\else \the#1\fi}
\def\mymonth#1{\ifcase#1 \or January \or February \or March \or April
   \or May \or June \or July \or August
   \or September \or Oktober
   \or November \or December \fi}

\def \TeXPrt {\TeX Prt}

\book
\contentslevel=3
\contfill={\dotfill}
\contskip=7pt
\let\scstyle=\bf
\font\subsubsectiontitlefont=cmr10 scaled \magstep1

\titlepage
\vskip 1in
\title{\TeXPrt}
\removelastskip
\smallskip
\title{A front-end for printing DVI files}
\bigskip
\release{Version 3.00}
\smallskip
\release {\mymonth{\month} \mynum{\day}, \mynum{\year}}
\bigskip
\author{by}
\author{Richard B\"odi}
\vfill
\abstract{
   \TeXPrt{} is a MUI driven front end for DVI printer drivers.
   It is highly configurable and can be used with various DVI
   printer drivers such as DVIPrint (PasTeX by Georg He\ss{}mann),
   DVILJP (AmigaTeX) and many others. \TeXPrt{} allows you to
   easily select the pages you want to print (whole document,
   from page \# to page \#, odd pages, even pages), the number of
   copies, landscape or portrait printing mode, horizontal and vertical
   offsets, reverse printing of the pages, and ten more user definable
   options. DVI printer drivers are defined by (ASCII) specification
   files. \TeXPrt{} has an ARexx port and interprets 17 commands.
}
\vskip 0.5in
\endtitlepage



\medskip
\plainsection{Contents}
\medskip
\makecontents
%%\newpage

\section{Copyright}

\TeXPrt{} is a ``freely distributable copyrighted software'',
i\thinspace e.\thinspace everyone may copy and use it, but the
copyright remains by myself (Richard B\"odi).

\TeXPrt{} may not be sold commercially without permission.
It may not be part of any PD series except Fred Fish's AmigaLibDisks.
Permission to modify the software is granted, but not the right to
distribute the modified code or only part of the files.

Thanks go to Georg He\ss{}mann for writing the PasTeX implementation
(I really enjoy it), Michael Balzer for designing ARexxBox (saved me a lot of time),
and Stefan Stuntz for his great Magic User Interface (MUI).
Last not least I want to thank Fred Fish for
the continuing release of his library disks.
For me, the quality of Fred's library disks has been one important reason for buying
an Amiga. And I never have repented it.


\section{Introduction}
\TeXPrt{} is a front end for DVI printer drivers, i.\thinspace e.\thinspace
it allows the user to control DVI printer drivers via a graphical user
interface. The GUI is based on Stefan Stuntz's Magic User Ibterface.
\TeXPrt{} supports the selection of the pages (whole document,
from page \# to page \#, odd pages, even pages), the number of
copies, landscape or portrait printing mode, horizontal and vertical
offsets, and provides ten more user definable options.

\section{Running \TeXPrt}

The \TeXPrt{} program can either be executed in a shell using parameters
or from Workbench using ToolTypes. When launched from Worbench, a DVI file
can be selected by first selecting the \TeXPrt{} icon, holding the SHIFT key,
and double clicking the desired DVI file. Having started \TeXPrt{}, the program
first looks for DVI driver specification files located in a subdrawer named
{\bf TeXDrivers}. If this drawer is empty or contains no valid specification file,
the program exits with an error message. For more information on DVI driver specification
files see the appropriate chapter below.

\subsection{Running \TeXPrt{} from the CLI}
\medskip
{\bf Format}: {\tt TeXPrt  [SHELL<Device>] [APPICON<Name of AppIcon>] [FILE<DVI file>]}
\smallskip
\noindent {\bf Pattern}: {\tt TeXPrt SHELL/K, APPICON/K, FILE/K}
\medskip
Description of the command line options:
\smallskip
\staggered{\tt APPICON\ }
\key{\tt SHELL}
   Specifies the shell from which the DVI printer driver should be launched.\hfill\break
   Example: {\tt SHELL=newwsh CNC:20/340/660/150/TeXPrt-Output} invokes the DVI
   printer driver from WShell using the CNC: device (a CNC: shell window
   has a scrollbar on the left). The default setting is
   {\tt newshell CON:0/0/640/150/TeXPrint-Output}.\hfill\break
   Note that you must not specify the SCREEN parameter in the shell! This is done
   by the SCREEN command. So don't use {\tt SHELL=CON://400/50/Title/SCREENShowDVI-PubScr},
   e.\thinspace g., use {\tt SCREEN=ShowDVI-PubScr SHELL=CON://400/50/Title} instead.
\key{\tt APPICON}
   Name of the AppIcon icon file (which must reside in the same directory as the
   \TeXPrt{} program). If no name is specified, no AppIcon will be generated.
\key{\tt FILE}
   The DVI file which should be printed.
\endstaggered

\subsection{Running \TeXPrt{} from Workbench}

When running \TeXPrt{} from Worbench a DVI file
can be selected by first clicking the \TeXPrt{} icon, holding the SHIFT key,
and double clicking the desired DVI file. The parameters are specified
by ToolTypes which can be edited by the Workbench's Info command.

\subsubsection{SHELL Tooltype}
   Specifies the shell from which the DVI printer driver should be launched.
   Note that you must not specify the SCREEN parameter in the shell! This is done
   by the SCREEN command. So don't use {\tt SHELL=CON://400/50/Title/SCREENShowDVI-PubScr},
   e.\thinspace g., use {\tt SCREEN=ShowDVI-PubScr SHELL=CON://400/50/Title} instead.

\subsubsection{APPICON Tooltype}
   Name of the AppIcon icon file (which must reside in the same directory as the
   \TeXPrt{} program). If no name is specified, no AppIcon will be generated.

\section{Selecting a DVI file}
A DVI file can be selected in six different ways.
\smallskip
\item{$\bullet$} During startup from a shell using the FILE keyword.
\item{$\bullet$} During startup from Workbench by
first selecting the \TeXPrt{} icon, holding the SHIFT key,
and double clicking the desired DVI file.
\item{$\bullet$} During runtime by selecting the string gadget named "DVI file"
and typing the name of the DVI file.
\item{$\bullet$} During runtime by pushing the GetFile gadget on the right of the
"DVI file" string gadget. The ASL file requester will appear and you may choose
your DVI file.
\item{$\bullet$} If \TeXPrt{} opens its window on the Workbench screen,
icons can be dragged into \TeXPrt's window. The name of the dragged icon
(including its path) is copied into the "DVI file" string gadget.
\item{$\bullet$} If you specified an AppIcon icon file, \TeXPrt{} creates an AppIcon
from that icon file, where other icons can be dragged onto. The name of the dragged icon
(including its path) is copied into the "DVI file" string gadget.

Remark: Since version 3.0 of \TeXPrt{} uses the MUI, the {\tt SCREEN} tooltype
is obsolete. Use the MUIPrefs program instead to specify the screen on which \TeXPrt{}
should appear.

\section{The DVI driver specification file}
The information about the available DVI printer drivers is stored
in DVI driver specification files located in a subdrawer named {\bf TeXDrivers}.
During startup \TeXPrt{} scans this directory and looks for these
specification files. For every valid specification file an entry in the
Drivers menu is created.
If the TeXDrivers drawer is empty or contains no valid specification file,
the program exits with an error message.
An example specification file for the DVIPrint printer driver (PasTeX)
is given below. All entries are separated by a semicolon. While reading a
specification file, every double quote will be substituted by a white space.
This is important, because some DVI drivers take their arguments without a space
(-f1 -t10, e.g.), while others expect one (-f 1 -t 10, e.g.). Two consecutive
double quotes indicate that the corresponding command is not supported
by the printer driver (see Copies in the example below, e.g.) or that
no command switch is necessary (see Device in the example below).
If a command is not supported by the printer driver, \TeXPrt{}
disables the appropriate gadget on its window.
\smallskip

{\tt
TeXPrt printer driver spec file \hfill\break
Name ; DVIPrint \hfill\break
Node ; Typesetting:Pastex/bin/DVIPrint \hfill\break
PageSel (DOCUMENT/FROMTO) ; DOCUMENT ; -f",-t","" \hfill\break
Copies ; 1 ; "" \hfill\break
PageType (ALL/ODD/EVEN) ; ALL ; "",-1,-2 \hfill\break
Reverse (ON/OFF) ; OFF ; -r \hfill\break
Orientation (PORTRAIT/LANDSCAPE) ; PORTRAIT ; "",-g \hfill\break
HOffset ; 0 ; -h" ; truemm ; mm \hfill\break
VOffset ; 0 ; -v" ; truemm ; mm \hfill\break
AdjHOffset ; 18 \hfill\break
AdjVOffset ; 16 \hfill\break
Option1 (ON/OFF) ; OFF ; -r ; Reverse \hfill\break
Option2 (ON/OFF) ; OFF ; DRAft ; Draft \hfill\break
Option3 (ON/OFF) ; ON ; -o ; Optimize \hfill\break
Option4 (ON/OFF) ; ON ; -T ; Fast \hfill\break
Option5 (ON/OFF) ; OFF ; -i ; IFF-ILBM \hfill\break
Option6 (ON/OFF) ; OFF ; "" ; "" \hfill\break
Option7 (ON/OFF) ; OFF ; "" ; "" \hfill\break
Option8 (ON/OFF) ; OFF ; "" ; "" \hfill\break
Option9 (ON/OFF) ; OFF ; "" ; "" \hfill\break
Option10 (ON/OFF) ; OFF ; "" ; "" \hfill\break
Device ; par: ; OUTTo= \hfill\break
DVIFile ; "" \hfill\break
Misc ; "" \hfill\break}
\medskip
The first line is used to indicate that this is a DVI driver specification file
(needed while scanning the {\bf TeXDrivers} drawer).\hfill\break
{\bf Name} specifies the string which will appear in the Drivers menu.\hfill\break
{\bf Node} contains the filename of the printer driver including the full path.
The path can be omitted if the printer driver is accessible via a global path.\hfill\break
The first entry after {\bf PageSel (DOCUMENT/FROMTO)} specifies the default setting when
this spec file is read by \TeXPrt. The second entry contains the parameters
(actually 3 parameters separated by a comma) of the printer driver to specify
from which page (-f) upto which page (-t) should be printed. The third parameter which is
not used (marked by "") in the file above determines the number of pages that should
be printed. Some printer driver use such kind of parameter instead of specifying
the last printed page directly (see the AmigaTeX spec file that comes with
this program). Note that
parameter strings may not contain any white space (use a double quote instead).\hfill\break
The {\bf Copies} keyword determines the number of copies that should be printed.
Note that, although the DVIPrint printer driver does not support printing multiple
copies of one file, this feature is emulated by \TeXPrt{} by repeatedly launching the
printer driver with the same DVI file. \hfill\break
{\bf PageType (ALL/ODD/EVEN)} sets the
type of pages that should be printed. Again the first entry specifies the default
setting while the second contains the parameter string (in the example above
there is no parameter for specifying ALL pages). \hfill\break
{\bf Orientation (PORTRAIT/LANDSCAPE)} determines the orientation of the printout.\hfill\break
{\bf HOffset} and {\bf VOffset} specify the horizontal and vertical offset of the
printout.
The third entry of these lines specify the unit measures of the offsets.
The strings of the last entries will be displayed on the right side of the HOffset and VOffset
string gadgets, respectively. They don't affect the behaviour of the printout.
Example, {\bf HOffset ; -5 ; -h" ; truemm ; mm} produces the command line {\bf -h -5truemm})
and writes the string "mm" to the right side of the HOffset string gadget.\hfill\break
{\bf AdjHOffset} and {\bf AdjVOffset} are used to preadjust the horizontal and
vertical offsets. This is necessary, because on different printers the margins
may be different too. \TeXPrt{} simply adds AdjHOffset to HOffset and
AdjVOffset to VOffset and these sums are used as offsets when the printer driver
is called.\hfill\break
The next ten lines {\bf Option\# (ON/OFF)} define user configurable boolean gadgets.
The first two entries set up the default state of the boolean gadget and the
parameter string. The last entry is used as a label for the gadget. \hfill\break
The next line of the spec file which starts with {\bf Device} determines the
output device (for example, par:) and the parameter string. {\bf DVIFile} specifies
the keyword for a DVI file ({\tt FILE}, for example). Finally, the {\bf Misc} entry
may contain an arbitrary string. This is used in the postscript driver spec file
{\tt postlj.drv} to add the init file {\tt init.ps}.

\section{The "texprint" environment variable}

To determine which printer driver should be preloaded when starting
\TeXPrt{}, the environment variable {\tt TEXPRINT} is used.\hfill\break
Example: {\tt\ \ \ setenv TEXPRINT "DVIPrint"} sets the DVIPrint driver
as the default driver.\hfill\break
If the environment variable {\tt TEXPRINT}\ is not set or if the specified
printer driver cannot be found in the {\bf TeXDrivers} directory, the first
entry which has been scanned is preloaded.

\section{Menu description}
The \TeXPrt{} program has two menus, namely the Config menu and the Drivers menu.

\subsection{The Config menu}
\staggered{\tt Save As \quad}
\key{\tt Save}
   Saves the current settings of the GUI to the current
   printer driver specification file.
\key{\tt Save As}
   Saves the current settings of the GUI to a user
   selectable file. This allows you to easily create new specification file.
   For example, you can define more than one specification file for a single
   printer driver containing different default values.
\key{\tt About}
   Displays the program version, a brief description of the program and
   my address.
\key{\tt Quit}
   What do you think?
\endstaggered

\subsection{The Drivers menu}
Contains the names of all DVI printer driver specification files found in the
{\bf TeXDrivers} drawer. Note that the number of spec files is limited
by the vertical size of the screen on which the \TeXPrt{} program will open its window.
The maximum length of the driver names is 64, although it may happen that
the menu cannot be created with large names of less than 64 characters.
In both cases \TeXPrt{} will exit and report that the menu structure could
not have been built. So make sure that neither there are too many
spec files in the {\bf TeXDrivers} drawer nor that the driver names are too long.

\section{ARexx}
\TeXPrt{} has an built-in ARexx port for receiving messages.
The name of the port is {\bf TEXPRT.1}.

\subsection{The TexPrtInit.tpr and TexPrtPrint.tpr macro files}
There are two ARexx command files named {\bf TexPrtInit.tpr}
and {\bf TexPrtPrint.tpr}. The first one of these is executed during startup
in the case where \TeXPrt{} detects that a message port named {\bf TeXPrtPort}
is already open. The TexPrtPrint.tpr which I have included simply pops to front
the public screen and \TeXPrt's window. The second
file TexPrtPrint.tpr is executed when you have confirmed the printout.
If ARexx is running on your machine this is all what is done when the printout
is confirmed. So if you really want to launch the printer driver in this case,
you must send \TeXPrt{} the
command {\tt PRINT} via ARexx. I have chosen this mechanism for flexibility reasons.
For example, the TexPrtPrint.tpr ARexx macro that comes with this archive
looks if the ShowDVI previewer is running, and if so, it requests the current
DVI file from the ShowDVI program and sends it to \TeXPrt{}. After that
it sends a {\tt PRINT} command to \TeXPrt{} to launch the printer driver.
If ARexx is not running or if you don't have ARexx (which I can't believe),
the printer driver is launched directly without using ARexx. 
{\bf Please don't forget to copy these two ARexx scripts to your Rexx: drawer
if you are running ARexx. Otherwise, \TeXPrt{} will NOT work!}

\subsection{ARexx commands}
There are 18 commands which \TeXPrt{} can interpret:
\medskip

\noindent{\tt CONFIG SAVE/S,SAVEAS/K} \par
   CONFIG SAVE saves the current setting of the GUI to the current selected
   printer driver spec file. CONFIG SAVEAS $<$filename$>$ saves the current setting
   of the GUI to the giver filename.
\smallskip
\noindent{\tt COPIES NUMBER/A/N} \par
   COPIES $<$nn$>$ places the number nn of copies into the "\# of Copies" string gadget.
\smallskip
\noindent{\tt DRIVER NAME/A} \par
   DRIVER $<$name$>$ selects the driver "name" (as given in the Drivers menu).
\smallskip
\noindent{\tt DVIFILE FILE/A} \par
   DVIFILE $<$filename$>$ selects the name of the DVI file which should be printed.
\smallskip
\noindent{\tt FROM\_TO DOCUMENT/S,FROM/N/K,TO/N/K} \par
   FROM\_TO DOCUMENT selects printing of the whole document.
   FROM\_TO FROM $<$nn$>$ sets the start of printing to page nn.
   FROM\_TO TO $<$nn$>$ sets the end of printing to page nn.
\smallskip
\noindent{\tt HOFFSET MM/A/N} \par
   HOFFSET $<$nn$>$ sets the horizontal offset to the value nn.
\smallskip
\noindent{\tt OPTION NUMBER/A/N,ON/S,OFF/S} \par
   OPTION \# ON selects the appropriate command, OPTION \# OFF deselects it.
   NUMBER is an integer ranging between 1 and 10.
\smallskip
\noindent{\tt ORIENTATION PORTRAIT/S,LANDSCAPE/S} \par
   ORIENTATION PORTRAIT sets portrait printing mode,
   ORIENTATION LANDSCAPE sets landscape printing mode.
\smallskip
\noindent{\tt OUTFILE FILE/A} \par
   DVIFILE $<$filename$>$ sets the filename or the output device.
\smallskip
\noindent{\tt PAGES ALL/S,EVEN/S,ODD/S} \par
   PAGES ALL sets the mode of printing to all pages,
   PAGES EVEN prints only even pages, PAGES ODD only odd pages.
\smallskip
\noindent{\tt PRINT} \par
   PRINT launches the specified printer driver with a set of parameters
   given by the values of the corresponding gadgets on \TeXPrt's window.
   \smallskip
\smallskip
\noindent{\tt TOFRONT} \par
\noindent{\tt TOBACK} \par
   TOFRONT brings the \TeXPrt{} window to the front, TOBACK will pop it to
   the back.
\smallskip
\noindent{\tt SCREENTOFRONT} \par
\noindent{\tt SCREENTOBACK} \par
   SCREENTOFRONT brings the screen on which the \TeXPrt{} window is located to 
   the front, SCREENTOBACK will pop this screen to the back.
\smallskip
\noindent{\tt QUIT} \par
   QUIT quits the program immediately.
\smallskip
\noindent{\tt VOFFSET MM/A/N} \par
   VOFFSET $<$nn$>$ sets the vertical offset to the value nn.

\section{Required software and hardware}
$\bullet$ An Amiga, of course. \hfill\break
$\bullet$ A printer, if available. \hfill\break
$\bullet$ Kickstart 2.04 or higher. \hfill\break
$\bullet$ Stefan Stuntz's Magical User Interface. \hfill\break
$\bullet$ ARexx (optional). \hfill\break
$\bullet$ A proper environment variable (optional). \hfill\break
$\bullet$ A DVI printer driver. \hfill\break
$\bullet$ A DVI file to print. \hfill\break
$\bullet$ A \TeX nician (optional). \hfill\break

\vfill\eject
\section{History}
\bigskip
\staggered{\bf Version 2.00\quad}
\key{\bf Version 2.00}
   First public release.
\key{\bf Version 2.01}
   The format of the DVI Driver specification file has changed for the
   {\tt HOffset} and {\tt VOffset} items. These items now have four instead of three
   parameters. The first two are as in Version 2.00. The third one only specifies
   the keyword which is appended after the offset value. It is no longer displayed
   on the right side of the Offset string gadgets. Instead, the fourth parameter
   is taken for that purpose. The fourth parameter is only used for display and
   doesn't affect the printout.
\key{\bf Version 3.00}
   \TeXPrt{} is now a MUI application. The format of the DVI Driver specification
   file has changed once again. The REVERSE checkmark has been deleted.
   On the other hand, the number of user definable checkmarks has been raised to ten,
   so it should be enough buttons left to include the REVERSE option there.
   The PUBSCREEN, XPOS, and YPOS tooltypes (parameters) no longer exist.
   The syntax of the ARexx commands OPTION and QUIT has changed, the semantic
   of TOBACK and TOFRONT has changed, and two new commands SCREENTOFRONT and
   SCREENTOBACK have been added.
\vskip 3cm

If you have any remarks (if you like the program or if not) or suggestions
for improvements feel free to contact me:
\bigskip

Richard A. B\"odi \par
Mathematisches Institut \par
Universit\"at T\"ubingen \par
Auf der Morgenstelle 10 \par
{\bf 72076 T\"ubingen} \par
GERMANY \par
\medskip
e-mail (Internet) : mmisa01@mailserv.zdv.uni-tuebingen.de\par

\bye
